{
  "settings": {
    "hasHeaders": true,
    "constrainDragToContainer": true,
    "reorderEnabled": true,
    "selectionEnabled": false,
    "popoutWholeStack": false,
    "blockedPopoutsThrowError": true,
    "closePopoutsOnUnload": true,
    "showPopoutIcon": false,
    "showMaximiseIcon": false,
    "showCloseIcon": false,
    "responsiveMode": "onload",
    "tabOverlapAllowance": 0,
    "reorderOnTabMenuClick": true,
    "tabControlOffset": 10
  },
  "dimensions": {
    "borderWidth": 5,
    "borderGrabWidth": 15,
    "minItemHeight": 10,
    "minItemWidth": 10,
    "headerHeight": 20,
    "dragProxyWidth": 300,
    "dragProxyHeight": 200
  },
  "labels": {
    "close": "close",
    "maximise": "maximise",
    "minimise": "minimise",
    "popout": "open in new window",
    "popin": "pop in",
    "tabDropdown": "additional tabs"
  },
  "content": [
    {
      "type": "row",
      "isClosable": true,
      "reorderEnabled": true,
      "title": "",
      "content": [
        {
          "type": "column",
          "isClosable": true,
          "reorderEnabled": true,
          "title": "",
          "width": 50,
          "content": [
            {
              "type": "stack",
              "header": {},
              "isClosable": true,
              "reorderEnabled": true,
              "title": "",
              "activeItemIndex": 0,
              "height": 50,
              "content": [
                {
                  "type": "component",
                  "componentName": "cascadeView",
                  "title": "CAD View",
                  "componentState": {
                    "componentName": "cascadeView",
                    "MeshRes": 0.1,
                    "MeshResRange": [
                      0.01,
                      2
                    ],
                    "Cache?": false,
                    "Radius": 30,
                    "RadiusRange": [
                      20,
                      40
                    ]
                  },
                  "isClosable": false,
                  "reorderEnabled": true
                }
              ]
            },
            {
              "type": "stack",
              "width": 50,
              "height": 50,
              "isClosable": true,
              "reorderEnabled": true,
              "title": "",
              "activeItemIndex": 0,
              "content": [
                {
                  "type": "component",
                  "componentName": "codeEditor",
                  "title": "* pipe3.json",
                  "componentState": {
                    "code": [
                      "function FilletRect(x,y,f,center) {",
                      "    let p0;",
                      "    let p1;",
                      "    let p2;",
                      "    let p3;",
                      "    if (center == false) ",
                      "    {",
                      "        p0 = [0,0];",
                      "        p1 = [x,0];",
                      "        p2 = [x,y];",
                      "        p3 = [0,y];",
                      "    }",
                      "    else",
                      "    {",
                      "        p0 = [-0.5*x,-0.5*y];",
                      "        p1 = [0.5*x, -0.5*y];",
                      "        p2 = [0.5*x,  0.5*y];",
                      "        p3 = [-0.5*x, 0.5*y];",
                      "    }        ",
                      "    return new Sketch(p0)",
                      "   .LineTo(p1).Fillet(f)",
                      "   .LineTo(p2).Fillet(f)",
                      "   .LineTo(p3).Fillet(f)",
                      "   .End(true).Fillet(f)",
                      "//                 .Face();",
                      " }",
                      "",
                      "function hackHelix(shape, ",
                      "{diameter = 10, ",
                      "pitch = 1.5, ",
                      "rotations = 5, ",
                      "divisions =360} = {}) ",
                      "{",
                      "// hacky because the correct way to make a thread would be to extrude a 2d shape along a helix",
                      "// which I think is supported by opencascade, but maybe not opencascade.js and therefore CascadeStudio",
                      "// This will get you by for now though",
                      "const degIncrement = 360/divisions",
                      "const heightIncrement = pitch/divisions",
                      "const circumferance = diameter*Math.PI",
                      "const rad2Deg = num => num*180/Math.PI",
                      "const pitchAngle = rad2Deg(Math.atan(pitch/circumferance))",
                      "",
                      "const loftWires = Array.from({length: divisions*rotations+1}).map(",
                      "        (_, index) => Rotate([0,0,-1], index*degIncrement,",
                      "                    Translate([0,diameter/2,index*heightIncrement],",
                      "                    Rotate([0,1,0], 90,",
                      "                    Rotate([0,-1,0], pitchAngle, shape)))))",
                      "    return Loft(loftWires)",
                      "}",
                      "",
                      "",
                      "",
                      "// face_init       = Translate([5,0,0],",
                      "//                   Rotate([0,-1,0],90,",
                      "//                   FilletRect(5,5,1,true).Face()));",
                      "// wire            = FilletRect(100,50,5,false).Wire();",
                      "// pipe_bottom     = Pipe(face_init,wire,false); ",
                      "// pipe_top        = Translate([0,0,50],pipe_bottom,true);",
                      "// pipe_front      = Rotate([1,0,0],90,pipe_bottom,true); ",
                      "// pipe_rear       = Translate([0,50,0],pipe_front,true); ",
                      "",
                      "",
                      "",
                      "",
                      "face_helix = FilletRect(5,5,1,false).Wire()",
                      "helix       = hackHelix(face_helix, {rotations: 3, pitch: 13, diameter: 50});",
                      "Translate([25,25,30],helix)",
                      "",
                      "",
                      "",
                      "",
                      "",
                      "",
                      "",
                      "",
                      "",
                      "",
                      "",
                      ""
                    ]
                  },
                  "width": 50,
                  "isClosable": false,
                  "reorderEnabled": true
                }
              ]
            }
          ]
        },
        {
          "type": "stack",
          "width": 50,
          "height": 100,
          "isClosable": true,
          "reorderEnabled": true,
          "title": "",
          "activeItemIndex": 0,
          "content": [
            {
              "type": "component",
              "componentName": "console",
              "title": "Console",
              "componentState": {},
              "height": 20,
              "isClosable": false,
              "reorderEnabled": true
            }
          ]
        }
      ]
    }
  ],
  "isClosable": true,
  "reorderEnabled": true,
  "title": "",
  "openPopouts": [],
  "maximisedItemId": null
}